﻿<%@ WebHandler Language="C#" Class="lists" %>
using Models;
using System;
using System.Web;
using Newtonsoft.Json;
using System.Linq;
using Newtonsoft.Json.Linq;
using System.Collections;


public class lists : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        string onlyId = context.Request.Headers["X-ACCESS-USER"];//Header中的token

        var uid=HttpContext.Current.Request.Form["uid"];

        if (uid!="0")
        {

            onlyId = uid;
        }


        if (string.IsNullOrEmpty(onlyId))
        {
            HttpContext.Current.Response.Write("parameter error");
            return;
        }

        var code = 1;
        var msg = "获取成功";
        var time = DateTime.Now;


        using (Entities bll = new Entities())
        {


            var data = bll.P_T_Sign.Where(s => s.UserId == onlyId).Select(x => new
            {

                x.TaskID,
                x.type,
                x.JF,
                x.addtime,
                x.photo,
                x.Approval

            }
           );


            var shortName = "广科";

            context.Response.Write(JsonConvert.SerializeObject(new { code, msg, time, data  }));

        }

        HttpContext.Current.Response.End();
        //context.Response.Write("Hello World");


    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }




}